#!/bin/bash
#

if [ -f ~/.ssh/id_rsa ];then
   rm -rf ~/.ssh/id_rsa*
fi

ssh-keygen -t rsa -f /root/.ssh/id_rsa -P "" &> /dev/null

if [ -f /root/.ssh/known_hosts ];then
   > /root/.ssh/known_hosts
fi

for i in 13 14;do
/usr/bin/expect << eof
set timeout 5
spawn ssh-copy-id root@192.168.152.$i
expect "(yes/no)?"
send "yes\n"
expect "password:"
send "123456\n"
expect eof
eof
done
